from django.db import models

# Create your models here.


# 网站名称
class SiteName(models.Model):
    name = models.CharField('网站名',max_length=255)

    guanlian = models.ManyToManyField(to='BookInfo')
    # pass


# 书籍信息
class BookInfo(models.Model):
    BookName = models.CharField('书名',max_length=255,default='null')
    BookAuth = models.CharField('作者',max_length=255,default='null')
    url = models.CharField('书籍地址',max_length=255,default='null')
    sect_id = models.BigIntegerField('书籍id（章节外键）',unique=True)
    # site = models.ForeignKey('BookDetail',on_delete=models.CASCADE,primary_key='site_id')

    # guanlian = models.ManyToManyField(to='SiteName')

# 具体内容
class BookDetail(models.Model):
    # id = models.AutoField('id')
    section = models.CharField('章节',max_length=100)
    content = models.TextField('内容')
    site_id = models.ForeignKey('BookInfo',on_delete=models.CASCADE,to_field='sect_id')




